<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form>
員工編號：<input type="text" name="user_id" value="0001" />
<input type="submit" value="搜尋" />
</form>

<sql:query var="rs" dataSource="jdbc/j2db">
	select *
	from users, shift, leavedata
	where users.user_id = shift.user_id
	and shift.shift_number = leavedata.shift_number
	and users.user_id = ?
	<sql:param>${param.user_id }</sql:param>
</sql:query>

<c:forEach var="r" items="${rs.rows }">
	${r.leaved_time_begin }
	${r.leaved_time_end }<br>
	<fmt:formatDate var="r.begin" value="${r.leaved_time_begin }" dateStyle="long"/>
	<fmt:formatDate var="r.end" value="${r.leaved_time_end }" dateStyle="long"/>
	<c:out value="${r.end}" />
</c:forEach>




</body>
</html>